package com.axun.ckz.yytmanager.presenter;

import android.content.Context;

import com.axun.ckz.yytmanager.base.IBasePresenter;
import com.axun.ckz.yytmanager.base.IBaseView;
import com.axun.ckz.yytmanager.module.WelcomeMd;
import com.axun.ckz.yytmanager.module.WelcomeModule;
import com.axun.ckz.yytmanager.view.WelcomeView;

public class WelcomePresenter extends IBasePresenter {

    Context context;
    WelcomeModule module;
    WelcomeView mView;

    public WelcomePresenter(Context context, IBaseView mView) {
        super(context, mView);
        this.context = context;
        this.mView = (WelcomeView) mView;
        module = new WelcomeMd(context);
    }

    public void intentTo(){
        if (isLogin()){
            toMain();
            setBaseData();
        }else {
            toLogin();
        }
    }

    private void setBaseData(){
        module.setServiceUrl();
        module.setUserInfo();
    }

    private void toMain(){
        if (mView!=null){
            mView.toMain();
        }
    }

    private void toLogin(){
        if (mView!=null){
            mView.toLogin();
        }
    }
}
